<template>
  <!-- 商品列表 -->
  <div class="maillList">
    <div class="mall" v-for="(item ,index) in mall_List" :key="index" @click="toMalldetail(item)">
      <div class="shopcheck" v-if="isEdit">
        <img v-if="item.isChecked" :src="imgOss+'/checked.png'" alt="" @click.stop="changeChecked(item)">
        <img v-if="!item.isChecked" :src="imgOss+'/check.png'" alt="" @click.stop="changeChecked(item)">
      </div>
      <div class="mallImg">
        <!-- 下架 -->
        <img class="xiajia" v-if="item.status==1" :src="imgOss+'/xiajia.png'" alt />
        <div
          class="mallImg_top"
          v-if="item.tag_name && item.tag_name !== null"
        >{{item.tag_name?item.tag_name:''}}</div>
        <img v-if="item.thumb_image" :src="imgUrl+item.thumb_image" class="img" />
        <img v-if="item.images" :src="imgUrl+item.images" class="img" />
        <div v-if="item.activity_status == 1" class="shop_type">即将开抢</div>
        <div v-if="item.activity_status == 2" class="shop_type">抢购中</div>
      </div>
      <h5 class="mall_name">
        <span v-if="item.cross_border == 1" class="icon"></span>
        {{item.title}}
      </h5>
      <div class="text1">
        <p class="original_price">
          <span class="pay_price">
            <span class="money_cent">￥</span>
            {{item.price}}
          </span>
          <span class="point">+{{item.deduction_credit}}积分</span>
        </p>
        <p class="plus" v-if="item.plus_title&&item.plus_title!=''">{{item.plus_title}}</p>
        <p class="pirce_num">
          价格
          <span class="icon">￥</span>
          <span class="price">{{item.origin_price}}</span>
          <span class="sell_num">销量{{item.sales_num}}</span>
        </p>
      </div>
    </div>
    <div class="zhanwei"></div>
  </div>
</template>

<script>
import common from "@/assets/js/mmk_common.js";
export default {
  data() {
    return {
      imgUrl: common.image_response,
      imgOss: common.image_resource
    };
  },
  props: {
    isEdit: false,
    mall_List: []
  },
  watch: {
    mall_List(newval, oldval) {
      this.mall_List = newval;
    }
  },
  methods: {
    // 点击选中
    changeChecked(item) {
      item.isChecked = !item.isChecked;
      this.$emit("shopClick", this.mall_List);
    },
    //到积分商城商品详情
    toMalldetail(params) {
      if(params.status==1){return}
      wx.navigateTo({
        url: `/pages/package_mall/goods_detail/main?goods_id=${params.id}&title=${
          params.title
        }`
      });
    }
  }
};
</script>

<style scoped lang="less">
/* 商品列表样式 */
.maillList {
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  columns: 2;
  flex-wrap: wrap;
  background: #f2f2f2;
  padding: 10px 15px 0;
  .mall {
    width: 49.6%;
    height: 100%;
    position: relative;
    margin-bottom: 6px;
    background: #fff;
    padding-bottom: 2px;
    border-radius: 6px;
    box-sizing: border-box;
    &:last-of-type {
      margin-bottom: 10px;
    }
    .shopcheck {
      position: absolute;
      top: 10px;
      right: 6px;
      z-index: 11;
      img{
        width:20px;
        height:20px;
      }
    }
    .mallImg {
      width: 100%;
      height: 170px;
      position: relative;
      .xiajia,
      .quehuo {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 170px;
        z-index: 10;
      }
      .mallImg_top {
        background: url("https://h5.ameimeika.com/mp_images/mp_2.7/icon_intergralmall_list_tag.png")
          no-repeat;
        background-size: 100% 100%;
        line-height: 15px;
        height: 22px;
        text-align: center;
        position: absolute;
        top: -4px;
        left: -4px;
        font-size: 9px;
        font-family: "Medium";
        font-weight: 500;
        color: rgba(255, 255, 255, 1);
        padding: 0 2px;
      }
      .img {
        width: 100%;
        height: 170px;
        border-radius: 6px 6px 0 0;
      }
      .shop_type {
        position: absolute;
        right: 6px;
        bottom: 6px;
        width: 80px;
        text-align: center;
        color: #fff;
        background: linear-gradient(
          213deg,
          rgba(255, 134, 105, 1) 0%,
          rgba(254, 106, 156, 1) 100%
        );
        border-radius: 20px;
        padding: 4px 0;
      }
    }
    .mall_name,
    .mall_dic {
      width: 100%;
      height: 40px;
      font-size: 14px;
      color: #444;
      margin-top: 5px;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      box-sizing: border-box;
      padding: 0 4px;
      .icon {
        width: 40px;
        height: 14px;
        display: inline-block;
        background: url("https://img.ameimeika.com/h5_images/mp_images/mp_3.0/mall/kuajing.png")
          no-repeat;
        background-size: 100% 100%;
      }
    }
    .text1 {
      width: 94%;
      position: relative;
      padding: 0 4px;
      .original_price {
        font-size: 12px;
        font-weight: 400;
        color: #f64665;
        line-height: 17px;
        .pay_credit {
          color: #ff7100;
        }
        .pay_price {
          color: #f64665;
          font-size: 14px;
          .money_cent {
            font-size: 11px;
            position: relative;
            top: 0;
          }
        }
        .point {
          width: 53px;
          height: 14px;
          background: rgba(255, 224, 224, 1);
          border-radius: 7px;
          display: inline-block;
          text-align: center;
          line-height: 14px;
          color: #fff;
          font-size: 10px;
          padding: 0 3px;
        }
      }
      .pirce_num {
        width: 100%;
        font-size: 10px;
        line-height: 14px;
        color: #999;
        margin-bottom: 10px;
        position: relative;
        .price {
          text-decoration: line-through;
        }
        .sell_num {
          font-size: 10px;
          color: #666666;
          opacity: 0.6;
          position: absolute;
          right: 2%;
          bottom: 0;
          zoom: 1;
        }
      }
      .plus {
        padding: 0 5px;
        margin: 4px 0;
        line-height: 16px;
        font-size: 10px;
        font-family: "PingFangSC-Medium", "PingFang SC";
        font-weight: 500;
        color: rgba(255, 255, 255, 1);
        background-image: url(https://img.ameimeika.com/h5_images/mp_images/mp_3.0.2/plus_bg%402x.png);
        background-repeat: no-repeat;
        background-size: 100% 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
      }
    }
  }
  .zhanwei {
    width: 100%;
    height: 100px;
  }
}
</style>
